class Delete:
    @classmethod
    def info(selt):
        # 1.导入pymysql
        import pymysql

        # 2.创建链接对象
        conn = pymysql.connect(user='root', password='root', database='advanced', charset='utf8')
        # 3.获取游标对象
        cursor = conn.cursor()
        # 4.执行sql语句
        try:
            info1 = input('输入删除标题：')
            sql = f'DELETE FROM journalism WHERE title = "{info1}"'
            rows = cursor.execute(sql)
            print(rows)
        except Exception as e:
            conn.rollback()
            print(e)
        else:
            conn.commit()
        # 5.提交或者回滚
        # 6.7关闭

        cursor.close()
        conn.close()
Delete.info()